package hikari.persistence.handlersimpl;

import com.gooddies.wiring.annotations.WiringComponent;
import hikari.objects3d.Basic3dObject;
import hikari.objects3d.Cube3dObject;
import hikari.persistence.file.FileSection;
import hikari.persistence.persisthandlers.IPersistantObject3dReadHandler;
import hikari.persistence.persisthandlers.PersistantHandler;
import org.swig.jirr.IMeshSceneNode;
import org.swig.jirr.ISceneManager;

/**
 * @author Dmitry
 */
@WiringComponent(singleton = true, lazy = true)
@PersistantHandler(sectionName = "cube")
public class CubeLoadHandler implements IPersistantObject3dReadHandler {

    private CubeLoadHandler() {
    }

    @Override
    public Basic3dObject read(ISceneManager sceneManager, Basic3dObject object, FileSection reader) {
        IMeshSceneNode cubeNode = Cube3dObject.createSceneNode(sceneManager);
        Cube3dObject cubeObject = new Cube3dObject("", cubeNode);
        cubeObject.setMeshSceneNode(cubeNode);
        return cubeObject;
    }
}
